package com.ikasoa.core.thrift.server;

import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;

import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.Map;
import java.util.EnumMap;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import javax.annotation.Generated;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 用于测试的简化版Thrift服务
 * <p>
 * 在IDL生成的Service基础上修改简化而成.
 * <p>
 * 只包含一个<code>get</code>
 * 方法,参数与返回值都为字符串,可以将对象转换为(json或xml等)字符串进行操作,这样可以避免使用IDL,灵活性更高.
 */
@SuppressWarnings({ "cast", "rawtypes", "serial", "unchecked", "unused" })
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.12.0)")
public class ThriftSimpleService {

	public interface Iface {
		public java.lang.String get(java.lang.String arg) throws org.apache.thrift.TException;
	}

	public interface AsyncIface {
		public void get(java.lang.String arg,
				org.apache.thrift.async.AsyncMethodCallback<java.lang.String> resultHandler)
				throws org.apache.thrift.TException;
	}

	public static class Client extends org.apache.thrift.TServiceClient implements Iface {
		public static class Factory implements org.apache.thrift.TServiceClientFactory<Client> {
			public Factory() {
			}

			public Client getClient(org.apache.thrift.protocol.TProtocol prot) {
				return new Client(prot);
			}

			public Client getClient(org.apache.thrift.protocol.TProtocol iprot,
					org.apache.thrift.protocol.TProtocol oprot) {
				return new Client(iprot, oprot);
			}
		}

		public Client(org.apache.thrift.protocol.TProtocol prot) {
			super(prot, prot);
		}

		public Client(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TProtocol oprot) {
			super(iprot, oprot);
		}

		public java.lang.String get(java.lang.String arg) throws org.apache.thrift.TException {
			send_get(arg);
			return recv_get();
		}

		public void send_get(java.lang.String arg) throws org.apache.thrift.TException {
			get_args args = new get_args();
			args.setArg(arg);
			sendBase("get", args);
		}

		public java.lang.String recv_get() throws org.apache.thrift.TException {
			get_result result = new get_result();
			receiveBase(result, "get");
			if (result.isSetSuccess())
				return result.success;
			throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT,
					"get failed: unknown result");
		}

	}

	public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface {
		public static class Factory implements org.apache.thrift.async.TAsyncClientFactory<AsyncClient> {
			private org.apache.thrift.async.TAsyncClientManager clientManager;
			private org.apache.thrift.protocol.TProtocolFactory protocolFactory;

			public Factory(org.apache.thrift.async.TAsyncClientManager clientManager,
					org.apache.thrift.protocol.TProtocolFactory protocolFactory) {
				this.clientManager = clientManager;
				this.protocolFactory = protocolFactory;
			}

			public AsyncClient getAsyncClient(org.apache.thrift.transport.TNonblockingTransport transport) {
				return new AsyncClient(protocolFactory, clientManager, transport);
			}
		}

		public AsyncClient(org.apache.thrift.protocol.TProtocolFactory protocolFactory,
				org.apache.thrift.async.TAsyncClientManager clientManager,
				org.apache.thrift.transport.TNonblockingTransport transport) {
			super(protocolFactory, clientManager, transport);
		}

		public void get(java.lang.String arg,
				org.apache.thrift.async.AsyncMethodCallback<java.lang.String> resultHandler)
				throws org.apache.thrift.TException {
			checkReady();
			get_call method_call = new get_call(arg, resultHandler, this, ___protocolFactory, ___transport);
			this.___currentMethod = method_call;
			___manager.call(method_call);
		}

		public static class get_call extends org.apache.thrift.async.TAsyncMethodCall<java.lang.String> {
			private java.lang.String arg;

			public get_call(java.lang.String arg,
					org.apache.thrift.async.AsyncMethodCallback<java.lang.String> resultHandler,
					org.apache.thrift.async.TAsyncClient client,
					org.apache.thrift.protocol.TProtocolFactory protocolFactory,
					org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
				super(client, protocolFactory, transport, resultHandler, false);
				this.arg = arg;
			}

			public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
				prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("get",
						org.apache.thrift.protocol.TMessageType.CALL, 0));
				get_args args = new get_args();
				args.setArg(arg);
				args.write(prot);
				prot.writeMessageEnd();
			}

			public java.lang.String getResult() throws org.apache.thrift.TException {
				if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ)
					throw new java.lang.IllegalStateException("Method call not finished!");
				org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(
						getFrameBuffer().array());
				org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
				return (new Client(prot)).recv_get();
			}
		}

	}

	public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor<I>
			implements org.apache.thrift.TProcessor {
		private static final org.slf4j.Logger _LOGGER = org.slf4j.LoggerFactory.getLogger(Processor.class.getName());

		public Processor(I iface) {
			super(iface, getProcessMap(
					new java.util.HashMap<java.lang.String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>>()));
		}

		protected Processor(I iface,
				java.util.Map<java.lang.String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) {
			super(iface, getProcessMap(processMap));
		}

		private static <I extends Iface> java.util.Map<java.lang.String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> getProcessMap(
				java.util.Map<java.lang.String, org.apache.thrift.ProcessFunction<I, ? extends org.apache.thrift.TBase>> processMap) {
			processMap.put("get", new get());
			return processMap;
		}

		public static class get<I extends Iface> extends org.apache.thrift.ProcessFunction<I, get_args> {

			public get() {
				super("get");
			}

			public get_args getEmptyArgsInstance() {
				return new get_args();
			}

			protected boolean isOneway() {
				return false;
			}

			@Override
			protected boolean rethrowUnhandledExceptions() {
				return false;
			}

			public get_result getResult(I iface, get_args args) throws org.apache.thrift.TException {
				get_result result = new get_result();
				result.success = iface.get(args.arg);
				return result;
			}

		}

	}

	public static class AsyncProcessor<I extends AsyncIface> extends org.apache.thrift.TBaseAsyncProcessor<I> {
		private static final org.slf4j.Logger _LOGGER = org.slf4j.LoggerFactory
				.getLogger(AsyncProcessor.class.getName());

		public AsyncProcessor(I iface) {
			super(iface, getProcessMap(
					new java.util.HashMap<java.lang.String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>>()));
		}

		protected AsyncProcessor(I iface,
				java.util.Map<java.lang.String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>> processMap) {
			super(iface, getProcessMap(processMap));
		}

		private static <I extends AsyncIface> java.util.Map<java.lang.String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>> getProcessMap(
				java.util.Map<java.lang.String, org.apache.thrift.AsyncProcessFunction<I, ? extends org.apache.thrift.TBase, ?>> processMap) {
			processMap.put("get", new get());
			return processMap;
		}

		public static class get<I extends AsyncIface>
				extends org.apache.thrift.AsyncProcessFunction<I, get_args, java.lang.String> {
			public get() {
				super("get");
			}

			public get_args getEmptyArgsInstance() {
				return new get_args();
			}

			public org.apache.thrift.async.AsyncMethodCallback<java.lang.String> getResultHandler(
					final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, final int seqid) {
				final org.apache.thrift.AsyncProcessFunction fcall = this;
				return new org.apache.thrift.async.AsyncMethodCallback<java.lang.String>() {
					public void onComplete(java.lang.String o) {
						get_result result = new get_result();
						result.success = o;
						try {
							fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid);
						} catch (org.apache.thrift.transport.TTransportException e) {
							_LOGGER.error("TTransportException writing to internal frame buffer", e);
							fb.close();
						} catch (java.lang.Exception e) {
							_LOGGER.error("Exception writing to internal frame buffer", e);
							onError(e);
						}
					}

					public void onError(java.lang.Exception e) {
						byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
						org.apache.thrift.TSerializable msg;
						get_result result = new get_result();
						if (e instanceof org.apache.thrift.transport.TTransportException) {
							_LOGGER.error("TTransportException inside handler", e);
							fb.close();
							return;
						} else if (e instanceof org.apache.thrift.TApplicationException) {
							_LOGGER.error("TApplicationException inside handler", e);
							msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
							msg = (org.apache.thrift.TApplicationException) e;
						} else {
							_LOGGER.error("Exception inside handler", e);
							msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
							msg = new org.apache.thrift.TApplicationException(
									org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
						}
						try {
							fcall.sendResponse(fb, msg, msgType, seqid);
						} catch (java.lang.Exception ex) {
							_LOGGER.error("Exception writing to internal frame buffer", ex);
							fb.close();
						}
					}
				};
			}

			protected boolean isOneway() {
				return false;
			}

			public void start(I iface, get_args args,
					org.apache.thrift.async.AsyncMethodCallback<java.lang.String> resultHandler)
					throws org.apache.thrift.TException {
				iface.get(args.arg, resultHandler);
			}
		}

	}

	public static class get_args implements org.apache.thrift.TBase<get_args, get_args._Fields>, java.io.Serializable,
			Cloneable, Comparable<get_args> {
		private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct(
				"get_args");
		private static final org.apache.thrift.protocol.TField ARG_FIELD_DESC = new org.apache.thrift.protocol.TField(
				"arg", org.apache.thrift.protocol.TType.STRING, (short) 1);
		private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new get_argsStandardSchemeFactory();
		private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new get_argsTupleSchemeFactory();
		public @org.apache.thrift.annotation.Nullable java.lang.String arg;

		public enum _Fields implements org.apache.thrift.TFieldIdEnum {
			ARG((short) 1, "arg");
			private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();
			static {
				for (_Fields field : java.util.EnumSet.allOf(_Fields.class))
					byName.put(field.getFieldName(), field);
			}

			@org.apache.thrift.annotation.Nullable
			public static _Fields findByThriftId(int fieldId) {
				switch (fieldId) {
				case 1:
					return ARG;
				default:
					return null;
				}
			}

			public static _Fields findByThriftIdOrThrow(int fieldId) {
				_Fields fields = findByThriftId(fieldId);
				if (fields == null)
					throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!");
				return fields;
			}

			@org.apache.thrift.annotation.Nullable
			public static _Fields findByName(java.lang.String name) {
				return byName.get(name);
			}

			private final short _thriftId;
			private final java.lang.String _fieldName;

			_Fields(short thriftId, java.lang.String fieldName) {
				_thriftId = thriftId;
				_fieldName = fieldName;
			}

			public short getThriftFieldId() {
				return _thriftId;
			}

			public java.lang.String getFieldName() {
				return _fieldName;
			}
		}

		public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
		static {
			java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(
					_Fields.class);
			tmpMap.put(_Fields.ARG, new org.apache.thrift.meta_data.FieldMetaData("arg",
					org.apache.thrift.TFieldRequirementType.DEFAULT,
					new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
			metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
			org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(get_args.class, metaDataMap);
		}

		public get_args() {
		}

		public get_args(java.lang.String arg) {
			this();
			this.arg = arg;
		}

		public get_args(get_args other) {
			if (other.isSetArg()) {
				this.arg = other.arg;
			}
		}

		public get_args deepCopy() {
			return new get_args(this);
		}

		@Override
		public void clear() {
			this.arg = null;
		}

		@org.apache.thrift.annotation.Nullable
		public java.lang.String getArg() {
			return this.arg;
		}

		public get_args setArg(@org.apache.thrift.annotation.Nullable java.lang.String arg) {
			this.arg = arg;
			return this;
		}

		public void unsetArg() {
			this.arg = null;
		}

		public boolean isSetArg() {
			return this.arg != null;
		}

		public void setArgIsSet(boolean value) {
			if (!value)
				this.arg = null;
		}

		public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
			switch (field) {
			case ARG:
				if (value == null)
					unsetArg();
				else
					setArg((java.lang.String) value);
				break;

			}
		}

		@org.apache.thrift.annotation.Nullable
		public java.lang.Object getFieldValue(_Fields field) {
			switch (field) {
			case ARG:
				return getArg();
			}
			throw new java.lang.IllegalStateException();
		}

		public boolean isSet(_Fields field) {
			if (field == null)
				throw new java.lang.IllegalArgumentException();
			switch (field) {
			case ARG:
				return isSetArg();
			}
			throw new java.lang.IllegalStateException();
		}

		@Override
		public boolean equals(java.lang.Object that) {
			if (that == null)
				return false;
			if (that instanceof get_args)
				return this.equals((get_args) that);
			return false;
		}

		public boolean equals(get_args that) {
			if (that == null)
				return false;
			if (this == that)
				return true;
			boolean this_present_arg = true && this.isSetArg();
			boolean that_present_arg = true && that.isSetArg();
			if (this_present_arg || that_present_arg) {
				if (!(this_present_arg && that_present_arg))
					return false;
				if (!this.arg.equals(that.arg))
					return false;
			}
			return true;
		}

		@Override
		public int hashCode() {
			int hashCode = 1;
			hashCode = hashCode * 8191 + ((isSetArg()) ? 131071 : 524287);
			if (isSetArg())
				hashCode = hashCode * 8191 + arg.hashCode();
			return hashCode;
		}

		@Override
		public int compareTo(get_args other) {
			if (!getClass().equals(other.getClass()))
				return getClass().getName().compareTo(other.getClass().getName());
			int lastComparison = 0;
			lastComparison = java.lang.Boolean.valueOf(isSetArg()).compareTo(other.isSetArg());
			if (lastComparison != 0)
				return lastComparison;
			if (isSetArg()) {
				lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.arg, other.arg);
				if (lastComparison != 0)
					return lastComparison;
			}
			return 0;
		}

		@org.apache.thrift.annotation.Nullable
		public _Fields fieldForId(int fieldId) {
			return _Fields.findByThriftId(fieldId);
		}

		public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
			scheme(iprot).read(iprot, this);
		}

		public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
			scheme(oprot).write(oprot, this);
		}

		@Override
		public java.lang.String toString() {
			java.lang.StringBuilder sb = new java.lang.StringBuilder("get_args(");
			boolean first = true;
			sb.append("arg:");
			if (this.arg == null)
				sb.append("null");
			else
				sb.append(this.arg);
			first = false;
			sb.append(")");
			return sb.toString();
		}

		public void validate() throws org.apache.thrift.TException {
		}

		private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
			try {
				write(new org.apache.thrift.protocol.TCompactProtocol(
						new org.apache.thrift.transport.TIOStreamTransport(out)));
			} catch (org.apache.thrift.TException te) {
				throw new java.io.IOException(te);
			}
		}

		private void readObject(java.io.ObjectInputStream in)
				throws java.io.IOException, java.lang.ClassNotFoundException {
			try {
				read(new org.apache.thrift.protocol.TCompactProtocol(
						new org.apache.thrift.transport.TIOStreamTransport(in)));
			} catch (org.apache.thrift.TException te) {
				throw new java.io.IOException(te);
			}
		}

		private static class get_argsStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
			public get_argsStandardScheme getScheme() {
				return new get_argsStandardScheme();
			}
		}

		private static class get_argsStandardScheme extends org.apache.thrift.scheme.StandardScheme<get_args> {

			public void read(org.apache.thrift.protocol.TProtocol iprot, get_args struct)
					throws org.apache.thrift.TException {
				org.apache.thrift.protocol.TField schemeField;
				iprot.readStructBegin();
				while (true) {
					schemeField = iprot.readFieldBegin();
					if (schemeField.type == org.apache.thrift.protocol.TType.STOP)
						break;
					switch (schemeField.id) {
					case 1:
						if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
							struct.arg = iprot.readString();
							struct.setArgIsSet(true);
						} else {
							org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
						}
						break;
					default:
						org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
					}
					iprot.readFieldEnd();
				}
				iprot.readStructEnd();
				struct.validate();
			}

			public void write(org.apache.thrift.protocol.TProtocol oprot, get_args struct)
					throws org.apache.thrift.TException {
				struct.validate();
				oprot.writeStructBegin(STRUCT_DESC);
				if (struct.arg != null) {
					oprot.writeFieldBegin(ARG_FIELD_DESC);
					oprot.writeString(struct.arg);
					oprot.writeFieldEnd();
				}
				oprot.writeFieldStop();
				oprot.writeStructEnd();
			}

		}

		private static class get_argsTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
			public get_argsTupleScheme getScheme() {
				return new get_argsTupleScheme();
			}
		}

		private static class get_argsTupleScheme extends org.apache.thrift.scheme.TupleScheme<get_args> {

			@Override
			public void write(org.apache.thrift.protocol.TProtocol prot, get_args struct)
					throws org.apache.thrift.TException {
				org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
				java.util.BitSet optionals = new java.util.BitSet();
				if (struct.isSetArg())
					optionals.set(0);
				oprot.writeBitSet(optionals, 1);
				if (struct.isSetArg())
					oprot.writeString(struct.arg);
			}

			@Override
			public void read(org.apache.thrift.protocol.TProtocol prot, get_args struct)
					throws org.apache.thrift.TException {
				org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
				java.util.BitSet incoming = iprot.readBitSet(1);
				if (incoming.get(0)) {
					struct.arg = iprot.readString();
					struct.setArgIsSet(true);
				}
			}
		}

		private static <S extends org.apache.thrift.scheme.IScheme> S scheme(
				org.apache.thrift.protocol.TProtocol proto) {
			return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY
					: TUPLE_SCHEME_FACTORY).getScheme();
		}
	}

	public static class get_result implements org.apache.thrift.TBase<get_result, get_result._Fields>,
			java.io.Serializable, Cloneable, Comparable<get_result> {
		private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct(
				"get_result");
		private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField(
				"success", org.apache.thrift.protocol.TType.STRING, (short) 0);
		private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new get_resultStandardSchemeFactory();
		private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new get_resultTupleSchemeFactory();
		public @org.apache.thrift.annotation.Nullable java.lang.String success;

		public enum _Fields implements org.apache.thrift.TFieldIdEnum {
			SUCCESS((short) 0, "success");

			private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();

			static {
				for (_Fields field : java.util.EnumSet.allOf(_Fields.class))
					byName.put(field.getFieldName(), field);
			}

			@org.apache.thrift.annotation.Nullable
			public static _Fields findByThriftId(int fieldId) {
				switch (fieldId) {
				case 0:
					return SUCCESS;
				default:
					return null;
				}
			}

			public static _Fields findByThriftIdOrThrow(int fieldId) {
				_Fields fields = findByThriftId(fieldId);
				if (fields == null)
					throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!");
				return fields;
			}

			@org.apache.thrift.annotation.Nullable
			public static _Fields findByName(java.lang.String name) {
				return byName.get(name);
			}

			private final short _thriftId;
			private final java.lang.String _fieldName;

			_Fields(short thriftId, java.lang.String fieldName) {
				_thriftId = thriftId;
				_fieldName = fieldName;
			}

			public short getThriftFieldId() {
				return _thriftId;
			}

			public java.lang.String getFieldName() {
				return _fieldName;
			}
		}

		// isset id assignments
		public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
		static {
			java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(
					_Fields.class);
			tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success",
					org.apache.thrift.TFieldRequirementType.DEFAULT,
					new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
			metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
			org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(get_result.class, metaDataMap);
		}

		public get_result() {
		}

		public get_result(java.lang.String success) {
			this();
			this.success = success;
		}

		public get_result(get_result other) {
			if (other.isSetSuccess())
				this.success = other.success;
		}

		public get_result deepCopy() {
			return new get_result(this);
		}

		@Override
		public void clear() {
			this.success = null;
		}

		@org.apache.thrift.annotation.Nullable
		public java.lang.String getSuccess() {
			return this.success;
		}

		public get_result setSuccess(@org.apache.thrift.annotation.Nullable java.lang.String success) {
			this.success = success;
			return this;
		}

		public void unsetSuccess() {
			this.success = null;
		}

		public boolean isSetSuccess() {
			return this.success != null;
		}

		public void setSuccessIsSet(boolean value) {
			if (!value)
				this.success = null;
		}

		public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
			switch (field) {
			case SUCCESS:
				if (value == null)
					unsetSuccess();
				else
					setSuccess((java.lang.String) value);
				break;
			}
		}

		@org.apache.thrift.annotation.Nullable
		public java.lang.Object getFieldValue(_Fields field) {
			switch (field) {
			case SUCCESS:
				return getSuccess();
			}
			throw new java.lang.IllegalStateException();
		}

		public boolean isSet(_Fields field) {
			if (field == null)
				throw new java.lang.IllegalArgumentException();
			switch (field) {
			case SUCCESS:
				return isSetSuccess();
			}
			throw new java.lang.IllegalStateException();
		}

		@Override
		public boolean equals(java.lang.Object that) {
			if (that == null)
				return false;
			if (that instanceof get_result)
				return this.equals((get_result) that);
			return false;
		}

		public boolean equals(get_result that) {
			if (that == null)
				return false;
			if (this == that)
				return true;
			boolean this_present_success = true && this.isSetSuccess();
			boolean that_present_success = true && that.isSetSuccess();
			if (this_present_success || that_present_success) {
				if (!(this_present_success && that_present_success))
					return false;
				if (!this.success.equals(that.success))
					return false;
			}
			return true;
		}

		@Override
		public int hashCode() {
			int hashCode = 1;
			hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287);
			if (isSetSuccess())
				hashCode = hashCode * 8191 + success.hashCode();
			return hashCode;
		}

		@Override
		public int compareTo(get_result other) {
			if (!getClass().equals(other.getClass()))
				return getClass().getName().compareTo(other.getClass().getName());
			int lastComparison = 0;
			lastComparison = java.lang.Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess());
			if (lastComparison != 0)
				return lastComparison;
			if (isSetSuccess()) {
				lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
				if (lastComparison != 0)
					return lastComparison;
			}
			return 0;
		}

		@org.apache.thrift.annotation.Nullable
		public _Fields fieldForId(int fieldId) {
			return _Fields.findByThriftId(fieldId);
		}

		public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
			scheme(iprot).read(iprot, this);
		}

		public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
			scheme(oprot).write(oprot, this);
		}

		@Override
		public java.lang.String toString() {
			java.lang.StringBuilder sb = new java.lang.StringBuilder("get_result(");
			boolean first = true;
			sb.append("success:");
			if (this.success == null)
				sb.append("null");
			else
				sb.append(this.success);
			first = false;
			sb.append(")");
			return sb.toString();
		}

		public void validate() throws org.apache.thrift.TException {
		}

		private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
			try {
				write(new org.apache.thrift.protocol.TCompactProtocol(
						new org.apache.thrift.transport.TIOStreamTransport(out)));
			} catch (org.apache.thrift.TException te) {
				throw new java.io.IOException(te);
			}
		}

		private void readObject(java.io.ObjectInputStream in)
				throws java.io.IOException, java.lang.ClassNotFoundException {
			try {
				read(new org.apache.thrift.protocol.TCompactProtocol(
						new org.apache.thrift.transport.TIOStreamTransport(in)));
			} catch (org.apache.thrift.TException te) {
				throw new java.io.IOException(te);
			}
		}

		private static class get_resultStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
			public get_resultStandardScheme getScheme() {
				return new get_resultStandardScheme();
			}
		}

		private static class get_resultStandardScheme extends org.apache.thrift.scheme.StandardScheme<get_result> {

			public void read(org.apache.thrift.protocol.TProtocol iprot, get_result struct)
					throws org.apache.thrift.TException {
				org.apache.thrift.protocol.TField schemeField;
				iprot.readStructBegin();
				while (true) {
					schemeField = iprot.readFieldBegin();
					if (schemeField.type == org.apache.thrift.protocol.TType.STOP)
						break;
					switch (schemeField.id) {
					case 0:
						if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
							struct.success = iprot.readString();
							struct.setSuccessIsSet(true);
						} else
							org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
						break;
					default:
						org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
					}
					iprot.readFieldEnd();
				}
				iprot.readStructEnd();
				struct.validate();
			}

			public void write(org.apache.thrift.protocol.TProtocol oprot, get_result struct)
					throws org.apache.thrift.TException {
				struct.validate();
				oprot.writeStructBegin(STRUCT_DESC);
				if (struct.success != null) {
					oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
					oprot.writeString(struct.success);
					oprot.writeFieldEnd();
				}
				oprot.writeFieldStop();
				oprot.writeStructEnd();
			}

		}

		private static class get_resultTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
			public get_resultTupleScheme getScheme() {
				return new get_resultTupleScheme();
			}
		}

		private static class get_resultTupleScheme extends org.apache.thrift.scheme.TupleScheme<get_result> {

			@Override
			public void write(org.apache.thrift.protocol.TProtocol prot, get_result struct)
					throws org.apache.thrift.TException {
				org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
				java.util.BitSet optionals = new java.util.BitSet();
				if (struct.isSetSuccess())
					optionals.set(0);
				oprot.writeBitSet(optionals, 1);
				if (struct.isSetSuccess())
					oprot.writeString(struct.success);
			}

			@Override
			public void read(org.apache.thrift.protocol.TProtocol prot, get_result struct)
					throws org.apache.thrift.TException {
				org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
				java.util.BitSet incoming = iprot.readBitSet(1);
				if (incoming.get(0)) {
					struct.success = iprot.readString();
					struct.setSuccessIsSet(true);
				}
			}

		}

		private static <S extends org.apache.thrift.scheme.IScheme> S scheme(
				org.apache.thrift.protocol.TProtocol proto) {
			return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY
					: TUPLE_SCHEME_FACTORY).getScheme();
		}

	}

}